/*
 * @描述:
 * @作者: 约訂
 * @Date: 2024-06-12 10:09:35
 * @LastEditTime: 2024-06-20 10:44:45
 * @修改人员: 约訂
 */
import Cookies from "js-cookie";
import Config from "@/settings";
import CryptoJS from "./cryptoData";
const TokenKey = Config.TokenKey;

export function getToken() {
  if (Cookies.get(TokenKey)) {
    return CryptoJS.decrypt(Cookies.get(TokenKey));
  }
  return false;
}

export function setToken(token) {
  return Cookies.set(TokenKey, CryptoJS.encrypt(token), {
    expires: Config.tokenCookieExpires,
  });
}

export function removeToken() {
  return Cookies.remove(TokenKey);
}
